//+-+-+-+-+
//|N|C|O|M|
//+-+-+-+-+---------------------------- Copyright 2009 scott a dixon [archxs] -+
//|                                                                            |
//| This file is part of the NanoCOM project <http://code.google.com/p/ncom/>. |
//|                                                                            |
//| Nano COM is free software: you can redistribute it and/or modify           |
//| it under the terms of the GNU Lesser General Public License as published   |
//| by the Free Software Foundation, either version 3 of the License, or       |
//| (at your option) any later version.                                        |
//|                                                                            |
//| Nano COM is distributed in the hope that it will be useful,                |
//| but WITHOUT ANY WARRANTY; without even the implied warranty of             |
//| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              |
//| GNU Lesser General Public License for more details.                        |
//|                                                                            |
//| You should have received a copy of the GNU General Public License          |
//| along with the Nano COM source.  If not, see                               |
//| <http://www.gnu.org/licenses/>.                                            |
//|                                                                            |
//+----------------------------------------------------------------------------+
#ifndef PLATFORMLINUX_H_
#define PLATFORMLINUX_H_

//+----------------------------------------------------------------------------+
//| COMPILER SPECIFIC                                                          |
//+----------------------------------------------------------------------------+
#define NCOM_FORCE_INLINE __inline

static void NCOM_FORCE_INLINE atomic_add(int* operand, int incr)
{
    asm volatile (
        "lock addl %1, %0\n" // add incr to operand
        : "=m" (*operand)
        : "r" (incr), "m" (*operand)
    );
};

//+----------------------------------------------------------------------------+
//| COM TYPES                                                                  |
//+----------------------------------------------------------------------------+
typedef long HRESULT;
typedef struct _GloballyUniqueIdentifier
{
    unsigned long  Data1;
    unsigned short Data2;
    unsigned short Data3;
    unsigned char  Data4[ 8 ];
} IID;

typedef IID GUID;
typedef unsigned long ULONG;
#define NCOM_METHOD_SPEC
#define NCOM_METHOD_DEF HRESULT
#define NCOM_METHOD_ATTRIBUTES __attribute__((cdecl))
#define interface struct

#endif /* PLATFORMLINUX_H_ */
